package servlets;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import lucenepdf.BuscaPdf;

/**
 * Servlet implementation class Prueba
 */
public class Prueba extends HttpServlet {
	private static final long serialVersionUID = 1L;
       

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String contenido = request.getParameter("txtBusca");
		String autor = request.getParameter("txtAutor");
		String fecha = request.getParameter("fecha");
		BuscaPdf resul = new BuscaPdf(contenido, autor, fecha);
		try{
		   request.setAttribute("resultado", resul.resultado());
		   getServletConfig().getServletContext().getRequestDispatcher("/resultados.jsp").forward(request, response);	
		}
		catch(Exception err){
			
		}
	}

}
